import { createRouter, createWebHistory } from 'vue-router'

// 开启历史模式
const routerHistory = createWebHistory();

const router = createRouter({
    history: routerHistory,
    routes: [
        {
            path: "/",
            redirect: "/home",
        },
        {
            path: '/home',
            name: 'Home',
            component: () => import('../views/common/Home.vue'),
            meta: {
                title: "首页 - 纸屋学术",
                isUserinfo: false,
                isPreview: false,
            },
        },
        {
            path: '/search/result',
            name: 'SearchResult',
            component: () => import('../views/search/Result.vue'),
            meta: {
                title: "检索结果 - 纸屋学术",
                isUserinfo: false,
                isPreview: false,
            },
        },
        {
            path: '/user/info',
            name: 'UserInfo',
            component: () => import('../views/user/UserInfo.vue'),
            meta: {
                title: "个人信息 - 纸屋学术",
                isUserinfo: true,
                isPreview: false,
            },
        },
        {
            path: '/user/news',
            name: 'NewsCenter',
            component: () => import('../views/user/NewsCenter.vue'),
            meta: {
                title: "消息中心 - 纸屋学术",
                isUserinfo: true,
                isPreview: false,
            },
        },
        {
            path: '/user/paper',
            name: 'MyPaper',
            component: () => import('../views/user/MyPaper.vue'),
            meta: {
                title: "我的成果 - 纸屋学术",
                isUserinfo: true,
                isPreview: false,
            },
        },
        {
            path: '/user/star',
            name: 'StarPaper',
            component: () => import('../views/user/StarPaper.vue'),
            meta: {
                title: "收藏论文 - 纸屋学术",
                isUserinfo: true,
                isPreview: false,
            },
        },
        {
            path: '/user/focus/author',
            name: 'FocusAuthor',
            component: () => import('../views/user/FocusAuthor.vue'),
            meta: {
                title: "关注学者 - 纸屋学术",
                isUserinfo: true,
                isPreview: false,
            },
        },
        {
            path: '/user/focus/venue',
            name: 'FocusVenue',
            component: () => import('../views/user/FocusVenue.vue'),
            meta: {
                title: "关注期刊/会议 - 纸屋学术",
                isUserinfo: true,
                isPreview: false,
            },
        },
        {
            path: '/user/focus/org',
            name: 'FocusOrg',
            component: () => import('../views/user/FocusOrg.vue'),
            meta: {
                title: "关注机构 - 纸屋学术",
                isUserinfo: true,
                isPreview: false,
            },
        },
        {
            path: '/user/focus/author',
            name: 'Focus',
            component: () => import('../views/user/FocusAuthor.vue'),
            meta: {
                title: "关注学者 - 纸屋学术",
                isUserinfo: true,
                isPreview: false,
            },
        },
        {
            path: '/user/manage',
            name: 'ManageCenter',
            component: () => import('../views/user/ManageCenter.vue'),
            meta: {
                title: "管理中心 - 纸屋学术",
                isUserinfo: true,
                isPreview: false,
            },
        },
        {
            path: '/user/contact',
            name: 'Contact',
            component: () => import('../views/user/ContactUs.vue'),
            meta: {
                title: "联系我们 - 纸屋学术",
                isUserinfo: true,
                isPreview: false,
            },
        },
        {
            path: '/paper/intro/:id',
            name: 'PaperIntro',
            component: () => import('../views/paper/PaperIntro.vue'),
            meta: {
                title: "论文简介 - 纸屋学术",
                isUserinfo: false,
                isPreview: false,
            },
        },
        {
            path: '/login',
            name: 'Login',
            component: () => import('../views/entry/Login.vue'),
            meta: {
                title: "登录 - 纸屋学术",
                isUserinfo: false,
                isPreview: false,
            },
        },
        {
            path: '/register',
            name: 'Register',
            component: () => import('../views/entry/Register.vue'),
            meta: {
                title: "注册 - 纸屋学术",
                isUserinfo: false,
                isPreview: false,
            },
        },
        {
            path: '/forget',
            name: 'Forget',
            component: () => import('../views/entry/Forget.vue'),
            meta: {
                title: "忘记密码 - 纸屋学术",
                isUserinfo: false,
                isPreview: false,
            },
        },
        {
            path: '/journal/:id',
            name: 'Journal',
            component: () => import('../views/entity/Journal.vue'),
            meta: {
                title: "期刊/会议主页 - 纸屋学术",
                isUserinfo: false,
                isPreview: false,
            },
        },
        {
            path: '/author/:id',
            name: 'Author',
            component: () => import('../views/entity/Author.vue'),
            meta: {
                title: "学者主页 - 纸屋学术",
                isUserinfo: false,
                isPreview: false,
            },
        },
        {
            path: '/org/:id',
            name: 'Org',
            component: () => import('../views/entity/Org.vue'),
            meta: {
                title: "机构主页 - 纸屋学术",
                isUserinfo: false,
                isPreview: false,
            },
        },
        {
            path: '/claim/:id',
            name: 'Claim',
            component: () => import('../views/entity/Claim.vue'),
            meta: {
                title: "门户认领 - 纸屋学术",
                isUserinfo: false,
                isPreview: false,
            },
        },
        {
            path: '/paper/preview/:id',
            name: 'Preview',
            component: () => import('../views/paper/Preview.vue'),
            meta: {
                title: "文献预览 - 纸屋学术",
                isUserinfo: false,
                isPreview: true,
            },
        },
        {
            path: '/404',
            name: '404',
            component: () => import('../views/common/404.vue'),
            meta: {
                title: "页面未找到 - 纸屋学术",
                isUserinfo: false,
                isPreview: false,
            },
        },
        {
            path: "/:catchAll(.*)",
            redirect: "/404",
        },
    ]
})

export default router